package com.atde._04_structural_design_patterns.proxy.staticproxy;


/**
 * @BelongsProject: hsp_java_design_mode
 * @BelongsPackage: com.atde._04_structural_design_patterns.proxy.staticproxy
 * @Author: Del
 * @CreateTime: 2025-06-23  20:17
 * @Description: TeacherDao 接口的静态代理类，用于在目标对象执行 teach() 方法前后添加代理逻辑
 * 体现代理模式中 “增强行为” 的核心思想
 * @Version: 1.0
 */
public class TeacherDaoProxy implements TeacherDao{
    /**
     * 被代理的目标对象，即实际执行业务逻辑的对象
     */
    private TeacherDao teacherDao;

    public TeacherDaoProxy(TeacherDao teacherDao) {
        this.teacherDao = teacherDao;
    }

    /**
     * 代理方法，在目标对象执行 teach() 方法前后添加前置和后置逻辑
     * 体现静态代理的核心功能，对原有的功能进行扩展
     */
    @Override
    public void teach() {
        System.out.println("代理开始");
        this.teacherDao.teach();
        System.out.println("代理结束");
    }
}
